/*
 * Line Class
 * 
 * Holds the configuration of a Line of the transit system
 * 
 * Builds switches, blocks, and inner classes of blocks
 * 
 */
package Track.Track;

import java.util.ArrayList;
import java.util.LinkedList;

/**
 *
 * @author Chris
 */
public class Line {
    protected ArrayList<Block> blockList = new ArrayList();
    protected ArrayList<Switch> switchList = new ArrayList();
    
    int lineID;
    
    //Contructor to Build either the Red or Green Line
    public Line(int i){
        lineID = i;
        if (lineID == 0)
            buildRed();
        else if(lineID == 1)
            buildGreen();
        else
            System.out.println("Invalid Line Contructor Input");
    }
    
    //Creates a new block and adds it to blockList
    private void addBlock(int id, double slope, double speedLim, double len, boolean bidirection, boolean under){
        Block temp = new Block(id, slope, speedLim, len, bidirection, under);
        blockList.add(temp);
    }
    //Creates a new switch and adds it to switchList
    private void addSwitch(int id, int fixed, int connected, int open, int line, boolean loop, boolean next){
        Switch temp = new Switch(id, fixed, connected, open, line, loop, next);
        switchList.add(temp);
        
    }
    //Add a station to the given block
    private void addStation(int block, String name){
        Block temp = getBlock(block);
        temp.addStation(name);
        this.blockList.set(block, temp);
    }
    //Add a crossing to the given block
    private void addCrossing(int block){
        Block temp = getBlock(block);
        temp.addCrossing();
        this.blockList.set(block, temp);
    }
    //Retreive the specified block
    protected Block getBlock(int id){
        return blockList.get(id);
    }
    //Connects blocks together
    private void setBlockOrder(int block, int previousBlock, int nextBlock){
        Block temp = getBlock(block);
        Block previous;
        Block next;                
        if (previousBlock != -1){
            previous = getBlock(previousBlock);
            temp.setPrevious(previous);
        }
        
        if (nextBlock != -1){
            next = getBlock(nextBlock);
            temp.setNext(next);
        }
        blockList.set(block, temp);
        
    }
    
    private void buildRed(){
        addBlock(0, 0, 40, 50, true, false);
        addBlock(1, (0.25/50), 40, 50, true, false);
        addBlock(2, (0.5/50), 40, 50, true, false);
        addBlock(3, (.75/50), 40, 50, true, false);
        addBlock(4, (1/50), 40, 50, true, false);
        addBlock(5, (.75/50), 40, 50, true, false);
        addBlock(6, (.5/50), 40, 50, true, false);
        addBlock(7, (.38/75), 40, 75, true, false);
        addBlock(8, 0, 40, 75, true, false);
        addBlock(9, 0, 40, 75, true, false);
        addBlock(10, 0, 40, 75, true, false);
        addBlock(11, (-.38/75), 40, 75, true, false);
        addBlock(12, (-.38/75), 40, 75, true, false);
        addBlock(13, (-.68/68.4), 40, 68.4, true, false);
        addBlock(14, (-.6/60), 40, 60, true, false);
        addBlock(15, (-.6/60), 40, 60, true, false);
        addBlock(16, (-.25/50), 40, 50, true, false);
        addBlock(17, (-1/200), 55, 200, true, false);
        addBlock(18, 0, 70, 400, true, false);
        addBlock(19, 0, 70, 400, true, false);
        addBlock(20, 0, 70, 200, true, false);
        addBlock(21, 0, 55, 100, true, false);
        addBlock(22, 0, 55, 100, true, false);
        addBlock(23, 0, 55, 100, true, false);
        addBlock(24, 0, 70, 50, true, true);
        addBlock(25, 0, 70, 50, true, true);
        addBlock(26, 0, 70, 50, true, true);
        addBlock(27, 0, 70, 50, true, true);
        addBlock(28, 0, 70, 50, true, true);
        addBlock(29, 0, 70, 60, true, true);
        addBlock(30, 0, 70, 60, true, true);
        addBlock(31, 0, 70, 50, true, true);
        addBlock(32, 0, 70, 50, true, true);
        addBlock(33, 0, 70, 50, true, true);
        addBlock(34, 0, 70, 50, true, true);
        addBlock(35, 0, 70, 50, true, true);
        addBlock(36, 0, 70, 50, true, true);
        addBlock(37, 0, 70, 50, true, true);
        addBlock(38, 0, 70, 50, true, true);
        addBlock(39, 0, 70, 50, true, true);
        addBlock(40, 0, 70, 60, true, true);
        addBlock(41, 0, 70, 60, true, true);
        addBlock(42, 0, 70, 50, true, true);
        addBlock(43, 0, 70, 50, true, true);
        addBlock(44, 0, 70, 50, true, true);
        addBlock(45, 0, 70, 50, true, true);
        addBlock(46, 0, 70, 75, true, true);
        addBlock(47, 0, 70, 75, true, true);
        addBlock(48, 0, 70, 75, true, true);
        addBlock(49, 0, 70, 50, true, false);
        addBlock(50, 0, 60, 50, true, false);
        addBlock(51, 0, 60, 50, true, false);
        addBlock(52, 0, 55, 43.2, true, false);
        addBlock(53, 0, 55, 50, true, false);
        addBlock(54, 0, 55, 50, true, false);
        addBlock(55, (0.38/75), 55, 75, true, false);
        addBlock(56, (0.38/75), 55, 75, true, false);
        addBlock(57, (0.38/75), 55, 75, true, false);
        addBlock(58, (0.75/75), 55, 75, true, false);
        addBlock(59, (.38/75), 55, 75, true, false);
        addBlock(60, 0, 55, 75, true, false);
        addBlock(61, (-0.38/75), 55, 75, true, false);
        addBlock(62, (-0.75/75), 55, 75, true, false);
        addBlock(63, (-0.75/75), 55, 75, true, false);
        addBlock(64, (-0.38/75), 55, 75, true, false);
        addBlock(65, 0, 55, 75, true, false);
        addBlock(66, 0, 55, 75, true, false);
        addBlock(67, 0, 55, 50, true, true);
        addBlock(68, 0, 55, 50, true, true);
        addBlock(69, 0, 55, 50, true, true);
        addBlock(70, 0, 55, 50, true, true);
        addBlock(71, 0, 55, 50, true, true);
        addBlock(72, 0, 55, 50, true, true);
        addBlock(73, 0, 55, 50, true, true);
        addBlock(74, 0, 55, 50, true, true);
        addBlock(75, 0, 55, 50, true, true);
        addBlock(76, 0, 55, 50, true, true);
        
        
        
        //Yard and Loop A through E
        setBlockOrder(0, -1, 9);
        setBlockOrder(1, 2, 16);
        setBlockOrder(2, 3, 1);
        setBlockOrder(3, 4, 2);
        setBlockOrder(4, 5, 3);
        setBlockOrder(5, 6, 4);
        setBlockOrder(6, 7, 5);
        setBlockOrder(7, 8, 6);
        setBlockOrder(8, 9, 7);
        setBlockOrder(9, 0, 8);
        setBlockOrder(10, 11, -1);
        setBlockOrder(11, 12, 10);
        setBlockOrder(12, 13, 11);
        setBlockOrder(13, 14, 12);
        setBlockOrder(14, 15, 13);
        setBlockOrder(15, -1, 14);
        
        //F through J
        setBlockOrder(16, 1, 17);
        setBlockOrder(17, 16, 18);
        setBlockOrder(18, 17, 19);
        setBlockOrder(19, 18, 20);
        setBlockOrder(20, 19, 21);
        setBlockOrder(21, 20, 22);
        setBlockOrder(22, 21, 23);
        setBlockOrder(23, 22, 24);
        setBlockOrder(24, 23, 25);
        setBlockOrder(25, 24, 26);
        setBlockOrder(26, 25, 27);
        setBlockOrder(27, 26, 28);
        setBlockOrder(28, 27, 29);
        setBlockOrder(29, 28, 30);
        setBlockOrder(30, 29, 31);
        setBlockOrder(31, 30, 32);
        setBlockOrder(32, 31, 33);
        setBlockOrder(33, 32, 34);
        setBlockOrder(34, 33, 35);
        setBlockOrder(35, 34, 36);
        setBlockOrder(36, 35, 37);
        setBlockOrder(37, 36, 38);
        setBlockOrder(38, 37, 39);
        setBlockOrder(39, 38, 40);
        setBlockOrder(40, 39, 41);
        setBlockOrder(41, 40, 42);
        setBlockOrder(42, 41, 43);
        setBlockOrder(43, 42, 44);
        setBlockOrder(44, 43, 45);
        setBlockOrder(45, 44, 46);
        setBlockOrder(46, 45, 47);
        setBlockOrder(47, 46, 48);
        setBlockOrder(48, 47, 49);
        
        //Loop J though N
        setBlockOrder(49, 48, 50);
        setBlockOrder(50, 49, 51);
        setBlockOrder(51, 50, 52);
        setBlockOrder(52, 51, 53);
        setBlockOrder(53, 52, 54);
        setBlockOrder(54, 53, 55);
        setBlockOrder(55, 54, 56);
        setBlockOrder(56, 55, 57);
        setBlockOrder(57, 56, 58);
        setBlockOrder(58, 57, 59);
        setBlockOrder(59, 58, 60);
        setBlockOrder(60, 59, 61);
        setBlockOrder(61, 60, 62);
        setBlockOrder(62, 61, 63);
        setBlockOrder(63, 62, 64);
        setBlockOrder(64, 63, 65);
        setBlockOrder(65, 64, 66);
        setBlockOrder(66, 65, -1);
        
        //OPQ Bypass
        setBlockOrder(67, -1, 68);
        setBlockOrder(68, 67, 69);
        setBlockOrder(69, 68, 70);
        setBlockOrder(70, 69, 71);
        setBlockOrder(71, 70, -1);
        
        //RST Bypass
        setBlockOrder(72, -1, 73);
        setBlockOrder(73, 72, 74);
        setBlockOrder(74, 73, 75);
        setBlockOrder(75, 74, 76);
        setBlockOrder(76, 75, -1);
        
        
        //Switches
        addSwitch(0, 9, 0, 10, 0, false, false);
        addSwitch(1, 16, 1, 15, 0, true, false);
        addSwitch(2, 27, 28, 76, 0, true, true);
        addSwitch(3, 32, 33, 72, 0, true, false);
        addSwitch(4, 38, 39, 71, 0, true, true);
        addSwitch(5, 43, 44, 67, 0, true, false);
        addSwitch(6, 52, 53, 66, 0, true, true);
        
        //Railway Crossing
        addCrossing(47);
        
        //Stations
        addStation(7, "Shadyside");
        addStation(16, "Herron Ave");
        addStation(21, "Swissville");
        addStation(25, "Penn Station");
        addStation(35, "Steel Plaza");
        addStation(45, "First Ave");
        addStation(48, "Station Square");
        addStation(60, "South Hills Junction");
    }
    
    private void buildGreen(){
        addBlock(0, 0, 40, 50, false, false);
        addBlock(1, (0.5/100), 55, 100, false, false);
        addBlock(2, (1/100), 55, 100, false, false);
        addBlock(3, (1.5/100), 55, 100, false, false);
        addBlock(4, (2/100), 55, 100, false, false);
        addBlock(5, (3/100), 55, 100, false, false);
        addBlock(6, (4/100), 55, 100, false, false);
        addBlock(7, (5/100), 55, 100, false, false);
        addBlock(8, 0, 55, 100, false, false);
        addBlock(9, (-5/100), 55, 100, false, false);
        addBlock(10, (-5/100), 55, 100, false, false);
        addBlock(11, (-4/100), 55, 100, false, false);
        addBlock(12, (-3/100), 55, 100, false, false);
        addBlock(13, 0, 70, 150, true, false);
        addBlock(14, 0, 70, 150, true, false);
        addBlock(15, 0, 70, 150, true, false);
        addBlock(16, 0, 70, 150, true, false);
        addBlock(17, 0, 60, 150, true, false);
        addBlock(18, 0, 60, 150, true, false);
        addBlock(19, 0, 60, 150, true, false);
        addBlock(20, 0, 60, 150, true, false);
        addBlock(21, 0, 70, 300, true, false);
        addBlock(22, 0, 70, 300, true, false);
        addBlock(23, 0, 70, 300, true, false);
        addBlock(24, 0, 70, 300, true, false);
        addBlock(25, 0, 70, 200, true, false);
        addBlock(26, 0, 70, 100, true, false);
        addBlock(27, 0, 70, 50, true, false);
        addBlock(28, 0, 70, 50, true, false);
        addBlock(29, 0, 70, 50, false, false);
        addBlock(30, 0, 70, 50, false, false);
        addBlock(31, 0, 70, 50, false, false);
        addBlock(32, 0, 70, 50, false, false);
        addBlock(33, 0, 70, 50, false, false);
        addBlock(34, 0, 70, 50, false, false);
        addBlock(35, 0, 70, 50, false, false);
        addBlock(36, 0, 70, 50, false, true);
        addBlock(37, 0, 70, 50, false, true);
        addBlock(38, 0, 70, 50, false, true);
        addBlock(39, 0, 70, 50, false, true);
        addBlock(40, 0, 70, 50, false, true);
        addBlock(41, 0, 70, 50, false, true);
        addBlock(42, 0, 70, 50, false, true);
        addBlock(43, 0, 70, 50, false, true);
        addBlock(44, 0, 70, 50, false, true);
        addBlock(45, 0, 70, 50, false, true);
        addBlock(46, 0, 70, 50, false, true);
        addBlock(47, 0, 70, 50, false, true);
        addBlock(48, 0, 70, 50, false, true);
        addBlock(49, 0, 70, 50, false, true);
        addBlock(50, 0, 70, 50, false, true);
        addBlock(51, 0, 70, 50, false, true);
        addBlock(52, 0, 70, 50, false, true);
        addBlock(53, 0, 70, 50, false, true);
        addBlock(54, 0, 70, 50, false, true);
        addBlock(55, 0, 70, 50, false, true);
        addBlock(56, 0, 70, 50, false, true);
        addBlock(57, 0, 70, 50, false, true);
        addBlock(58, 0, 60, 50, false, false);
        addBlock(59, 0, 60, 50, false, false);
        addBlock(60, 0, 60, 50, false, false);
        addBlock(61, 0, 60, 50, false, false);
        addBlock(62, 0, 60, 50, false, false);
        addBlock(63, 0, 70, 100, false, false);
        addBlock(64, 0, 70, 100, false, false);
        addBlock(65, 0, 70, 200, false, false);
        addBlock(66, 0, 70, 200, false, false);
        addBlock(67, 0, 70, 100, false, false);
        addBlock(68, 0, 70, 100, false, false);
        addBlock(69, 0, 60, 100, false, false);
        addBlock(70, 0, 60, 100, false, false);
        addBlock(71, 0, 60, 100, false, false);
        addBlock(72, 0, 60, 100, false, false);
        addBlock(73, 0, 60, 100, false, false);
        addBlock(74, 0, 60, 100, false, false);
        addBlock(75, 0, 60, 100, false, false);
        addBlock(76, 0, 60, 100, false, false);
        addBlock(77, 0, 70, 300, true, false);
        addBlock(78, 0, 70, 300, true, false);
        addBlock(79, 0, 70, 300, true, false);
        addBlock(80, 0, 70, 300, true, false);
        addBlock(81, 0, 70, 300, true, false);
        addBlock(82, 0, 70, 300, true, false);
        addBlock(83, 0, 70, 300, true, false);
        addBlock(84, 0, 70, 300, true, false);
        addBlock(85, 0, 70, 300, true, false);
        addBlock(86, 0, 55, 100, false, false);
        addBlock(87, 0, 55, 86.6, false, false);
        addBlock(88, 0, 55, 100, false, false);
        addBlock(89, (-0.385/75), 55, 75, false, false);
        addBlock(90, (-0.75/75), 55, 75, false, false);
        addBlock(91, (-1.5/75), 55, 75, false, false);
        addBlock(92, 0, 55, 75, false, false);
        addBlock(93, (1.5/75), 55, 75, false, false);
        addBlock(94, (0.75/75), 55, 75, false, false);
        addBlock(95, (0.375/75), 55, 75, false, false);
        addBlock(96, 0, 55, 75, false, false);
        addBlock(97, 0, 55, 75, false, false);
        addBlock(98, 0, 55, 75, false, false);
        addBlock(99, 0, 55, 75, false, false);
        addBlock(100, 0, 55, 75, false, false);
        addBlock(101, 0, 55, 35, false, false);
        addBlock(102, 0, 60, 100, false, false);
        addBlock(103, 0, 60, 100, false, false);
        addBlock(104, 0, 60, 80, false, false);
        addBlock(105, 0, 60, 100, false, false);
        addBlock(106, 0, 60, 100, false, false);
        addBlock(107, 0, 60, 90, false, false);
        addBlock(108, 0, 60, 100, false, false);
        addBlock(109, 0, 60, 100, false, false);
        addBlock(110, 0, 70, 100, false, false);
        addBlock(111, 0, 70, 100, false, false);
        addBlock(112, 0, 70, 100, false, false);
        addBlock(113, 0, 70, 100, false, false);
        addBlock(114, 0, 70, 100, false, false);
        addBlock(115, 0, 70, 100, false, false);
        addBlock(116, 0, 70, 100, false, false);
        addBlock(117, 0, 60, 50, false, false);
        addBlock(118, 0, 60, 50, false, false);
        addBlock(119, 0, 60, 40, false, false);
        addBlock(120, 0, 60, 50, false, false);
        addBlock(121, 0, 60, 50, false, true);
        addBlock(122, 0, 70, 50, false, true);
        addBlock(123, 0, 70, 50, false, true);
        addBlock(124, 0, 70, 50, false, true);
        addBlock(125, 0, 70, 50, false, true);
        addBlock(126, 0, 70, 50, false, true);
        addBlock(127, 0, 70, 50, false, true);
        addBlock(128, 0, 70, 50, false, true);
        addBlock(129, 0, 70, 50, false, true);
        addBlock(130, 0, 70, 50, false, true);
        addBlock(131, 0, 70, 50, false, true);
        addBlock(132, 0, 70, 50, false, true);
        addBlock(133, 0, 70, 50, false, true);
        addBlock(134, 0, 70, 50, false, true);
        addBlock(135, 0, 70, 50, false, true);
        addBlock(136, 0, 70, 50, false, true);
        addBlock(137, 0, 70, 50, false, true);
        addBlock(138, 0, 70, 50, false, true);
        addBlock(139, 0, 70, 50, false, true);
        addBlock(140, 0, 70, 50, false, true);
        addBlock(141, 0, 70, 50, false, true);
        addBlock(142, 0, 70, 50, false, true);
        addBlock(143, 0, 70, 50, false, true);
        addBlock(144, 0, 70, 50, false, false);
        addBlock(145, 0, 70, 50, false, false);
        addBlock(146, 0, 70, 50, false, false);
        addBlock(147, 0, 70, 50, false, false);
        addBlock(148, 0, 70, 40, false, false);
        addBlock(149, 0, 70, 40, false, false);
        addBlock(150, 0, 70, 35, false, false);
        
        //Yard
        setBlockOrder(0, -1, 62);
        //A Through F
        setBlockOrder(1, 2, -1);
        setBlockOrder(2, 3, 1);
        setBlockOrder(3, 4, 2);
        setBlockOrder(4, 5, 3);
        setBlockOrder(5, 6, 4);
        setBlockOrder(6, 7, 5);
        setBlockOrder(7, 8, 6);
        setBlockOrder(8, 9, 7);
        setBlockOrder(9, 10, 8);
        setBlockOrder(10, 11, 9);
        setBlockOrder(11, 12, 10);
        setBlockOrder(12, 11, 13);
        setBlockOrder(13, 12, 14);
        setBlockOrder(14, 13, 15);
        setBlockOrder(15, 14, 16);
        setBlockOrder(16, 15, 17);
        setBlockOrder(17, 16, 18);
        setBlockOrder(18, 17, 19);
        setBlockOrder(19, 18, 20);
        setBlockOrder(20, 19, 21);
        setBlockOrder(21, 20, 22);
        setBlockOrder(22, 21, 23);
        setBlockOrder(23, 22, 24);
        setBlockOrder(24, 23, 25);
        setBlockOrder(25, 24, 26);
        setBlockOrder(26, 25, 27);
        setBlockOrder(27, 26, 28);
        setBlockOrder(28, 27, -1);
        
        //G thorugh J
        setBlockOrder(29, -1, 30);
        setBlockOrder(30, 29, 31);
        setBlockOrder(31, 30, 32);
        setBlockOrder(32, 31, 33);
        setBlockOrder(33, 32, 34);
        setBlockOrder(34, 33, 35);
        setBlockOrder(35, 34, 36);
        setBlockOrder(36, 35, 37);
        setBlockOrder(37, 36, 38);
        setBlockOrder(38, 37, 39);
        setBlockOrder(39, 38, 40);
        setBlockOrder(40, 39, 41);
        setBlockOrder(41, 40, 42);
        setBlockOrder(42, 41, 43);
        setBlockOrder(43, 42, 44);
        setBlockOrder(44, 43, 45);
        setBlockOrder(45, 44, 46);
        setBlockOrder(46, 45, 47);
        setBlockOrder(47, 46, 48);
        setBlockOrder(48, 47, 49);
        setBlockOrder(49, 48, 50);
        setBlockOrder(50, 49, 51);
        setBlockOrder(51, 50, 52);
        setBlockOrder(52, 51, 53);
        setBlockOrder(53, 52, 54);
        setBlockOrder(54, 53, 55);
        setBlockOrder(55, 54, 56);
        setBlockOrder(56, 55, 57);
        setBlockOrder(57, 56, 58);
        setBlockOrder(58, 57, 59);
        setBlockOrder(59, 58, 60);
        setBlockOrder(60, 59, 61);
        setBlockOrder(61, 60, -1);
        
        //K through Q
        setBlockOrder(62, 0, 63);
        setBlockOrder(63, 62, 64);
        setBlockOrder(64, 63, 65);
        setBlockOrder(65, 64, 66);
        setBlockOrder(66, 65, 67);
        setBlockOrder(67, 66, 68);
        setBlockOrder(68, 67, 69);
        setBlockOrder(69, 68, 70);
        setBlockOrder(70, 69, 71);
        setBlockOrder(71, 70, 72);
        setBlockOrder(72, 71, 73);
        setBlockOrder(73, 72, 74);
        setBlockOrder(74, 73, 75);
        setBlockOrder(75, 74, 76);
        setBlockOrder(76, 75, 77);
        setBlockOrder(77, 76, 78);
        setBlockOrder(78, 77, 79);
        setBlockOrder(79, 78, 80);
        setBlockOrder(80, 79, 81);
        setBlockOrder(81, 80, 82);
        setBlockOrder(82, 81, 83);
        setBlockOrder(83, 82, 84);
        setBlockOrder(84, 83, 85);
        setBlockOrder(85, 84, 86);
        setBlockOrder(86, 85, 87);
        setBlockOrder(87, 86, 88);
        setBlockOrder(88, 87, 89);
        setBlockOrder(89, 88, 90);
        setBlockOrder(90, 89, 91);
        setBlockOrder(91, 90, 92);
        setBlockOrder(92, 91, 93);
        setBlockOrder(93, 92, 94);
        setBlockOrder(94, 93, 95);
        setBlockOrder(95, 94, 96);
        setBlockOrder(96, 95, 97);
        setBlockOrder(97, 96, 98);
        setBlockOrder(98, 97, 99);
        setBlockOrder(100, 99, -1);
        
        //R through Z
        setBlockOrder(101, -1, 102);
        setBlockOrder(102, 101, 103);
        setBlockOrder(103, 102, 104);
        setBlockOrder(104, 103, 105);
        setBlockOrder(105, 104, 106);
        setBlockOrder(106, 105, 107);
        setBlockOrder(107, 106, 108);
        setBlockOrder(108, 107, 109);
        setBlockOrder(109, 108, 110);
        setBlockOrder(110, 109, 111);
        setBlockOrder(111, 110, 112);
        setBlockOrder(112, 111, 113);
        setBlockOrder(113, 112, 114);
        setBlockOrder(114, 113, 115);
        setBlockOrder(115, 114, 116);
        setBlockOrder(116, 115, 117);
        setBlockOrder(117, 116, 118);
        setBlockOrder(118, 117, 119);
        setBlockOrder(119, 118, 120);
        setBlockOrder(120, 119, 121);
        setBlockOrder(121, 120, 122);
        setBlockOrder(122, 121, 123);
        setBlockOrder(123, 122, 124);
        setBlockOrder(124, 123, 125);
        setBlockOrder(125, 124, 126);
        setBlockOrder(126, 125, 127);
        setBlockOrder(127, 126, 128);
        setBlockOrder(128, 127, 129); 
        setBlockOrder(129, 128, 130);
        setBlockOrder(130, 129, 131);
        setBlockOrder(131, 130, 132);
        setBlockOrder(132, 131, 133);
        setBlockOrder(133, 132, 134);
        setBlockOrder(134, 133, 135);
        setBlockOrder(135, 134, 136);
        setBlockOrder(136, 135, 137);
        setBlockOrder(137, 136, 138);
        setBlockOrder(138, 137, 139);
        setBlockOrder(139, 138, 140);
        setBlockOrder(140, 139, 141);
        setBlockOrder(141, 140, 142);
        setBlockOrder(142, 141, 143);
        setBlockOrder(143, 142, 144);
        setBlockOrder(144, 143, 145);
        setBlockOrder(145, 144, 146);
        setBlockOrder(146, 145, 147);
        setBlockOrder(147, 146, 148);
        setBlockOrder(148, 147, 149);
        setBlockOrder(149, 148, 150);
        setBlockOrder(150, 149, 28);
    
        
        //Switches
        addSwitch(0, 13, 12, 1, 1, true, true);
        addSwitch(1, 28, 151, 29, 1, true, true);
        addSwitch(2, 57, 58, 0, 1, false, true);
        addSwitch(3, 63, 0, 62, 1, false, false);
        addSwitch(4, 77, 76, 101, 1, true, false);
        addSwitch(5, 85, 86, 100, 1, true, true);
        
        //Railway Crossing
        addCrossing(19);
        
        //Stations
        addStation(2, "Pioneer");
        addStation(9, "Edgebrook");
        addStation(16, "Station Station");
        addStation(22, "Whited");
        addStation(31, "South Bank");
        addStation(39, "Central");
        addStation(48, "Inglewood");
        addStation(57, "Overbrook");
        addStation(65, "Glenbury");
        addStation(73, "Dormont");
        addStation(77, "Mt Lebanon");
        addStation(88, "Poplar");
        addStation(96, "Castle Shannon");
        addStation(105, "Dormont");
        addStation(114, "Glenbury");
        addStation(122, "Overbrook");
        addStation(132, "Inglewood");
        addStation(142, "Central");
    }
            
    
}
